package ngat.oss.simulation;

import java.rmi.*;
import java.io.*;

public class BasicDBProviderLauncher {

    public static void main(String[] args) {

	try {
	    
	    String root = args[0];
	    String db   = args[1];

	    System.setProperty("jydodb", db);

	    File dbDir = new File(db);

	    BasicDBProvider dbp = new BasicDBProvider();

	    dbp.loadCache(root, dbDir);
	    
	    Naming.rebind(root+"_DBProvider", dbp);
	    System.err.println("BasicDBProvider bound as ["+root+"_DBProvider]");

	    // busy wait to keep alive
	    while (true) {
		try{Thread.sleep(60000L);} catch (Exception e) {}
	    }
	    
	} catch (Exception e) {
	    e.printStackTrace();
	    System.err.println("BasicDBProvider <root> <jydodb>");
	    return;
	}
    }

}
